package com.squirrel.michale.node;

/**
 * @author guanhao 观浩
 * @version 1.0.0.0
 * @createTime 2023/1/19 8:51 PM
 * @company Michale Squirrel
 * @link
 * @description Definition for singly-linked list.
 */
public class ListNode {


    int val;
    ListNode next;

    ListNode() {
    }

    ListNode(int val) {
        this.val = val;
    }

    ListNode(int val, ListNode next) {
        this.val = val;
        this.next = next;
    }

    @Override
    public String toString() {
        if (next == null) {
            return "(" + val + " next=null)";
        } else {

            return "(" + val + " next=" +  next.toString() + ")";
        }
    }
}
